<template>
	<view class="container">
		<view class="title">
			<span>员工：<span style="color: red;">{{ parentRow.workName }}</span></span>
			<span>日期：<span style="color: red;">{{ parentRow.monthAndYearAndDay }}</span></span>
		</view>

		<view class="flex">
			<span>指令：</span>
			<uv-input style="margin-top: 10rpx;" v-model="lotNo" placeholder="请选择指令"></uv-input>
		</view>

		<view class="flex">
			<span>工序：</span>
			<uv-input style="margin-top: 10rpx;" v-model="progress" placeholder="请选择工序"></uv-input>
		</view>

		<view class="btns">
			<button @click="search" class="button">搜索</button>
			<button @click="reset" class="buttonRS">重置</button>
		</view>

		<uv-notify ref="notify" type="error"></uv-notify>

		<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scroll="scroll">
			<uni-table border stripe emptyText="暂无更多数据">
				<!-- 表头行 -->
				<uni-tr>
					<uni-th :width="60" align="center">指令</uni-th>
					<uni-th :width="70" align="center">工序</uni-th>
					<uni-th :width="70" align="center">数量</uni-th>
					<uni-th :width="70" align="center">单价</uni-th>
					<uni-th :width="70" align="center">金额</uni-th>
				</uni-tr>
				<!-- 表格数据行 -->
				<uni-tr v-for="item in tableList">
					<uni-td align="center">{{item.lotNo}}</uni-td>
					<uni-td align="center">{{item.processName}}</uni-td>
					<uni-td align="center">{{item.qty}}</uni-td>
					<uni-td align="center">{{item.price}}</uni-td>
					<uni-td align="center">{{item.amt}}</uni-td>
				</uni-tr>
			</uni-table>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tableList: [],
				lotNo: '',
				progress: '',
				parentRow: {},
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
			}
		},
		methods: {
			search() {
				this.getTableList()
			},
			reset() {
				this.lotNo = ''
				this.progress = ''
			},
			getTableList() {
				let token = uni.getStorageSync('token');
				let userInfo = uni.getStorageSync('userInfo')
				uni.request({
					url: '/kl/pad/stitchProducedValue/getEmployeeDailyProcessSalary',
					header: {
						'Authorization': token //自定义请求头信息
					},
					data: {
						...userInfo.departmentList[0],
						...this.parentRow,
						lotNo: this.lotNo,
						processName: this.progress
					},
					method: "POST",
					success: (res) => {
						console.log({
							...userInfo.departmentList[0],
							...this.parentRow,
							lotNo: this.lotNo,
							processName: this.progress
						}, res)
						if (res.data.code === 200) {
							this.tableList = res.data.data.list
							this.total = res.data.data.totalAmt
						} else {
							this.$refs.notify.show({
								message: res.data.message
							});
						}
					}
				});
			},
		},
		onLoad(data) {
			console.log(11111111111111111,data)
			// console.log(JSON.parse(data.parentRow))
			this.parentRow = JSON.parse(data.parentRow)
			this.getTableList()
		}
	}
</script>

<style>
	.title {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.container {
		padding: 0 30rpx 0;
	}

	.flex {
		display: flex;
		align-items: center;
	}

	.btns {
		margin-bottom: 30rpx;
		margin-top: 30rpx;
		display: flex;
		justify-content: space-between;
	}

	.scroll-Y {
		height: 70vh;
	}

	.scroll-view_H {
		white-space: nowrap;
		width: 100%;
	}

	.scroll-view-item {
		height: 70vh;
		line-height: 70vh;
		text-align: center;
		font-size: 36rpx;
	}

	.scroll-view-item_H {
		display: inline-block;
		width: 100%;
		height: 70vh;
		line-height: 70vh;
		text-align: center;
		font-size: 36rpx;
	}
</style>